﻿using Autohome.Login.Models;
using Autohome.Login.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Autohome.Login.Controllers
{
    public class LoginController : Controller
    {
        private readonly ILoginInfoService _loginInfoService;
        public LoginController(ILoginInfoService loginInfoService)
        {
            _loginInfoService = loginInfoService;
        }

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Add()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Add(LoginInfo model)
        {
            var result = _loginInfoService.Create(model);
            if (result)
            {
                return View("Index");
            }
            return View("Whatever");
        }
    }
}